package org.apak.tests;

import junit.framework.TestCase;

import org.apak.hibernate.HibernateUtil;
import org.apak.model.StatusTypeTest;
import org.hibernate.Query;
import org.hibernate.Session;

public class DAOTest extends TestCase {

	public StatusTypeTest getStatusType() {
		StatusTypeTest type = null;
		Session session = null;
		try {
			session = HibernateUtil.getSessionFactory().getCurrentSession();
			session.beginTransaction();
			Query q = session
					.createQuery("from StatusTypeTest where so_status_type=1");
			type = (StatusTypeTest) q.uniqueResult();

		} catch (Exception e) {
			e.printStackTrace();
		}
		return type;
	}
	
	public void testGetStatusType() {
		StatusTypeTest type = getStatusType();
		System.out.println(type.getType_name());
		assertEquals("Too vastu voetud", type.getType_name().trim());
	}

}
